package com.sandasai.action.authority;
import com.opensymphony.xwork2.Action;
import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionInvocation;
import com.opensymphony.xwork2.interceptor.AbstractInterceptor;
import com.sandasai.vo.UserBean;
public class TeacherAuthorityInterceptor extends AbstractInterceptor {
    /**
     * 
     */
    private static final long serialVersionUID = 1L;
    @Override
    public String intercept(ActionInvocation invocation) throws Exception {
        ActionContext ctx = ActionContext.getContext();
        Integer level = (Integer)ctx.getSession()
                .get("userType");
        if(level != null 
                && (level.equals(UserBean.USER_TYPE_TEACHER))) {
            return invocation.invoke();
        }else {
            return Action.LOGIN;
        }
    }
}